const KoaRouter = require('@koa/router')
const loginController = require('../controller/login.controller')
const { verifyLogin, verifyAuth } = require('../middleware/login.middleware')

const loginRouter = new KoaRouter({ prefix: "/login" })

loginRouter.post('/', verifyLogin, loginController.sign)
loginRouter.get('/otherPage', verifyAuth, (ctx, next) => {
  ctx.body = {
    msg: '登录成功，能访问其他页面'
  }
})

module.exports = loginRouter